﻿@model smartcrm.Models.PortalOrderList
@{Layout = "../Shared/_PortalLayout.cshtml";}

<script src="../../Scripts/Portal/index.js"></script>

<div id="tabs">
  <ul>
    <li><a href="#tabs-1">待确认订单(@Model.UnApprovedOrders.Count)</a></li>
    <li><a href="#tabs-2">已确认订单(@Model.ApprovedOrders.Count)</a></li> 
  </ul>
  <div id="tabs-1" style="min-height:300px;">

    <div id="list1" class="list">
        <table>
            <thead>
                <tr>
                    <th style="width:100px">订单编号</th>
                    <th style="width:80px">创建日期</th>                    
                    <th>订单名称</th>
                    <th style="width:65px">订单状态</th> 
                    <th style="width:80px">操作</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.UnApprovedOrders)
                {
                    <tr id="@item.OrderNo">
                        <td>@Html.DisplayFor(modelItem => item.OrderNo)</td>
                        <td>@item.TransactionDate.ToString("yyyy-MM-dd")</td> 
                        <td>@Html.DisplayFor(modelItem => item.OrderName)</td>  
                        <td>@Html.DisplayFor(modelItem => item.StatusDescription)</td>              
                        <td>
                            <img src="../../Images/grid/edit.png" title="编辑" onclick="javascript:EditOrder('@item.OrderNo')" /> 
                            <img src="../../Images/grid/detail.png" title="查看详细信息" onclick="javascript:ShowDetail('@item.OrderNo')" />
                            <img src="../../Images/grid/attachments.png" title="附件" onclick="javascript:ShowAttachment('@item.OrderNo')" />     
                        </td>
                    </tr>
                }        
            </tbody>
        </table>
    </div>

  </div>
  <div id="tabs-2" style="min-height:300px">    
     <div id="list2" class="list">
        <table>
            <thead>
                <tr>
                    <th style="width:100px">订单编号</th>
                    <th style="width:80px">创建日期</th>                   
                    <th>订单名称</th>
                    <th style="width:65px">订单状态</th>
                    <th style="width:65px">支付状态</th>
                    <th style="width:55px">操作</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.ApprovedOrders)
                {
                    <tr id="@item.OrderNo">
                        <td>@Html.DisplayFor(modelItem => item.OrderNo)</td>
                        <td>@item.TransactionDate.ToString("yyyy-MM-dd")</td> 
                        <td>@Html.DisplayFor(modelItem => item.OrderName)</td>  
                        <td>@Html.DisplayFor(modelItem => item.StatusDescription)</td>  
                        <td>@Html.DisplayFor(modelItem => item.PaymentStatusDescription)</td>              
                        <td>
                            <img src="../../Images/grid/detail.png" title="查看详细信息" onclick="javascript:ShowDetail('@item.OrderNo')" />  
                        </td>
                    </tr>
                }        
            </tbody>
        </table>
    </div>

  </div>
</div>

<div id="divDetail" title="订单详细信息" style="display:none">
    <div style="display:inline; float:left; margin-bottom:5px;"><span class="OrderStatus">订单状态：</span><span class="OrderStatus" id="dStatus"></span></div>         
    <div id="divDetailContent" class="list" style="overflow-y: auto; height: 400px;">                    
        <table class="tableEdit">
            <tr>
                <td class="label">订单编号</td>
                <td id="dOrderNo"></td>
                <td class="label">订单名称</td>                
                <td id="dOrderName"></td>
            </tr>
            <tr>
                <td class="label">客户</td>
                <td id="dCustomer"></td>
                <td class="label">联系人</td>                
                <td id="dContact"></td>
            </tr> 
            <tr>
                <td class="label">数量</td>
                <td id="dNumber"></td>
                <td class="label">预计完工</td>
                <td id="dExpectDeliveryDate"></td>                
            </tr>
            <tr>
                <td class="label">创建者</td>
                <td id="dCreator"></td>
                <td class="label">创建时间</td>
                <td id="dCreatedTime"></td>
            </tr>
            <tr>               
                <td class="label">备注</td>
                <td colspan="3" id="dMemo"></td>                
            </tr>
            <tr>
                <td class="label">自助查询URL</td>
                <td colspan="3" id="dQueryURL"></td>                
            </tr>
            <tr>
                <td class="label">明细</td>
                <td colspan="3" id="dDetail"></td>                
            </tr>            
            <tr style="height:120px">
                <td class="label">流程</td>
                <td colspan="3" id='tdWorkFlow'>
                </td>
            </tr>
            <tr>
                <td class="label">附件</td>
                <td colspan="3" id='tdAttachment'>
                </td>
            </tr>            
        </table>

    </div>
    <div style="text-align:right;">       
       <input type="button" onclick="javascript:$('#divDetail').dialog('close');" value="关闭" />    
    </div>  
</div>

<div id="divAttachment" title="附件" style="display:none">
    <div style="overflow-y: auto; height: 260px;">                    
        <table class="tableEdit">
            <tr>
                <td class="label" style="width:60px" >附件</td>
                <td class="list" style="height:180px; vertical-align:top;">                   
                     <table id='tAttachment' style="width:100%">
                        <thead>
                            <tr>
                                <th style="width:10%;">类型</th>
                                <th style="width:57%">名称</th>
                                <th style="width:15%">上传者</th>
                                <th style="width:18%">操作</th>
                            </tr>  
                        </thead>
                        <tbody  id="dAttachment" >
                        
                        </tbody>                         
                    </table>                   
                </td>
            </tr>
            <tr>
                <td class="label" style="width:80px">上传</td>
                <td style="vertical-align:middle">
               
                    <input style="float:left; width:240px;" type="file" id="fileToUpload" name="fileToUpload" />  
                    <img style="float:right; margin-right:10px; display:none" id="loading"   src="/Images/loading.gif" alt=""  />
                    <div style="clear:both; color:red; font-weight:bold">
                    &nbsp;注意：文件大小不能超过 @Model.FileSizeLimitation<span></span>             
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div style="text-align:right;">           
       <span id="errorMessageAttachment" class="errorSpan"></span>    
       <input type="button" value="上传并保存" id="btnUpload" />    
       <input type="button" onclick="javascript:$('#divAttachment').dialog('close');" value="关闭" />    
    </div>   
</div> 

<input type="hidden" id="OrderNo" />